package cn.lookup.service.impl;

import cn.lookup.dao.RoleDao;
import cn.lookup.domain.Role;
import cn.lookup.service.RoleService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.stereotype.Service;

import java.util.List;

@Service("roleService")
public class RoleServiceImpl implements RoleService {
    @Autowired
    @Qualifier("roleDao")
    private RoleDao roleDao;
    public List<Role> getRoleList() {
        List<Role> roleList = roleDao.getRoleList();
        return roleList;
    }

    public void addRole(Role role) {
        roleDao.addRole(role);
    }

    public List<Role> getRolesByUserId(Long userId) {
        List<Role> roles = roleDao.getRolesByUserId(userId);
        return roles;
    }

    public void deleteRole(Long roleId) {
        roleDao.deleteRole(roleId);
    }
}
